package com.ibuonline.b2b.entity;

import java.io.Serializable;

public class ArticlePic implements Serializable {

	private static final long serialVersionUID = -377762691339763174L;

	//fields
	private java.lang.Integer id;
	private java.lang.Integer artId;
	private java.lang.String picPath;
	private java.lang.String descr;
	private java.sql.Timestamp lastupdate;

	//default constructor
	public ArticlePic() {
	}

	//getter
	public java.lang.Integer getId() {
		return id;
	}
	public java.lang.Integer getArtId() {
		return artId;
	}
	public java.lang.String getPicPath() {
		return picPath;
	}
	public java.lang.String getDescr() {
		return descr;
	}
	public java.sql.Timestamp getLastupdate() {
		return lastupdate;
	}

	//setter
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public void setArtId(java.lang.Integer artId) {
		this.artId = artId;
	}
	public void setPicPath(java.lang.String picPath) {
		this.picPath = picPath;
	}
	public void setDescr(java.lang.String descr) {
		this.descr = descr;
	}
	public void setLastupdate(java.sql.Timestamp lastupdate) {
		this.lastupdate = lastupdate;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof ArticlePic))
			return false;

		final ArticlePic articlePic = (ArticlePic)other;
		if (!this.id.equals(articlePic.getId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(id).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("ArticlePic[")
			.append("id=").append(id).append(", ")
			.append("artId=").append(artId).append(", ")
			.append("picPath=").append(picPath).append(", ")
			.append("descr=").append(descr).append(", ")
			.append("lastupdate=").append(lastupdate).append("]").toString();
	}
	
	///###########
	public String getPicUrl() {
		 if (picPath == null) {
	           return null;
	     }
		 return com.ibuonline.b2b.common.ResourceUtil.getResPath(picPath);
	}
}